using System.Globalization;
using System.Windows;
using System.Windows.Data;
using DocumentManager.Models;

namespace DocumentManager;

/// <summary>
/// 枚举到可见性转换器
/// </summary>
public class EnumToVisibilityConverter : IValueConverter
{
    public static readonly EnumToVisibilityConverter Instance = new();

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is DocumentNodeType nodeType)
        {
            return nodeType == DocumentNodeType.Title ? Visibility.Visible : Visibility.Collapsed;
        }
        return Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
} 